import {request} from '../utils/request/index.ts'
const prefix = 'http://localhost:3001/admin/'

import { LoginInter,ResReturnInter,RegisterInter,VerifycodeInter,EditpassInter } from './types.ts'


export const loginApi = (data:LoginInter):Promise<ResReturnInter>=>request.post(prefix + 'login',data,{responseType:'json'})
export const verifycodeApi = (data:VerifycodeInter):Promise<ResReturnInter>=>request.post(prefix + 'verifycode',data,{responseType:'json'})
export const registerApi = (data:RegisterInter):Promise<ResReturnInter>=>request.post(prefix + 'register',data,{responseType:'json'})
export const editpass = (data:EditpassInter):Promise<ResReturnInter>=>request.post(prefix + 'editpass',data,{responseType:'json'})

// 双token
export const refreshTokenApi = ()=>request.get(prefix+'refreshToken',{headers:{pass:sessionStorage.getItem("accessToken")}})
